Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Scripting Additions Guide /
Chapter 2 - Scripting Addition Commands / Command Definitions
/


Time to GMT

The Time to GMT command returns the difference, in seconds, between the current time and Greenwich mean time (GMT). It is the only command provided by the Time to GMT scripting addition.

SYNTAX
time to GMT
PARAMETERS
None.

RESULT
An integer indicating the difference in seconds between the current time
and GMT.

EXAMPLES
Time to GMT returns the difference in seconds between the time of your computer's clock and GMT. For example, if you are in Cupertino, California, and your computer is set to Pacific Standard Time, Time to GMT returns
this result:

time to GMT
--result: -28800
You can then use this value to write a script that tells you the time difference between the time in any other time zone and the current time in Cupertino:

property offsetFromCupertino : -28800

set x to ((time to GMT) ÷ 60) ÷ 60
set y to x - (((offsetFromCupertino) ÷ 60) ÷ 60)

if y = 0 then
   display dialog ("Same time zone as Cupertino") as string
else
   if y > 0 then
      display dialog (y & " Hours Ahead of Cupertino") as 
string
   else
      display dialog (-y & " Hours Behind Cupertino") as 
string
   end if
end if
To see the effect this script has for different time zones, try setting the time from the Map control panel to various locations, for example, Tokyo, London, and Atlanta.

ERRORS
Error
number
Error message
-108Out of memory.
-1700Can't make some data into the expected type.
-1701Some parameter is missing for <commandName>.
-1704Some parameter was invalid.
-1705Operation involving a list item failed.
-1708<reference> doesn't understand the <commandName> message.
-1718Reply has not yet arrived.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
18 DEC 1996